<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Cate_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_select('row[cate_id]', $ruledata, $row['cate_id'], ['class'=>'form-control', 'required'=>''])}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-type" class="form-control" name="row[type]">
                <option value="1" {if condition="$row.type eq 1"} selected{/if}>单选</option>
                <option value="2" {if condition="$row.type eq 2"} selected{/if}>多选</option>
            </select>
        </div>
    </div>
    <div class="form-group" id="appenddiv">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-2">
            <a href="#" id="AddMoreFileBox" class="btn btn-info">增加选项</a></span></p>
        </div>
    </div>
    <div id="InputsWrapper" style="position: relative;top: 60px;float: left;">
        {volist name="$option" id="vo"}
        <div style='margin: 3px;'>
            <span>试题:</span><input type="text" name="row[option][{$vo.order}]" value="{$vo.content}"/>
            <span>价格:</span><input type="text" name="row[money][{$vo.order}]"  value="{$vo.price}"/>
            <a href="#" id="resremoveclass_{$vo.id}" onclick="del('{$vo.id}');">
                <input type="button" value="删除">
            </a>
        </div>
        {/volist}
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script src='http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js'></script>
<script>
    $(document).ready(function() {

        var InputsWrapper   = $("#InputsWrapper"); //Input boxes wrapper ID
        var AddButton       = $("#AddMoreFileBox"); //Add button ID

        var x = InputsWrapper.length; //initlal text box count
        var FieldCount=1; //to keep track of text box added

        $(AddButton).click(function (e)  //on add input button click
        {
            FieldCount++; //text box added increment
            //add input box
            var html ="<div style='margin: 3px;'>" +
                "<span>试题</span><input type=\"text\" name=\"row[option]['"+(FieldCount-1)+"']\" />" +
                "&nbsp;&nbsp;<span>价格</span><input type=\"text\" name=\"row[money]['"+(FieldCount-1)+"']\" />" +
                "<a href=\"#\" class=\"removeclass\">" +
                "<input type=\"button\" value=\"删除\">" +
                "</a>" +
                "</div>";
            $(InputsWrapper).append(html);
            x++; //text box increment


        });

        $("body").on("click",".removeclass", function(e){ //user click on remove text
                $(this).parent('div').remove(); //remove text box
                x--; //decrement textbox
        })
    });
    function del(id){ //user click on remove text
        $("#resremoveclass_"+id).parent('div').remove(); //remove text box
    }
</script>